﻿//-----------------------------------------------------------------------
// <copyright file="Tuple.cs" company="tuliprules.org">
//     Copyright (c) 2010 tuplelister, tuliprules.org.
// </copyright>
// <summary>This is the Tuple class.</summary>
//-----------------------------------------------------------------------

namespace Tulip.Engine.Models.ClosedWorld
{
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Windows.Markup;
    using Collections;

    /// <summary>
    /// Represents a type of tuple within the runtime model.
    /// </summary>
    [ContentProperty("Attributes")]
    public class Tuple : ElementBase
    {
        /// <summary>
        /// Initializes a new instance of the Tuple class.
        /// </summary>
        public Tuple()
        {
            this.Attributes = new Attributes();
        }

        /// <summary>
        /// Gets or sets the mode of the tuple.
        /// </summary>
        /// <remarks>
        /// An Entity mode tuple is bound to a single 'fact' at runtime and represents a distinct entity.
        /// A Join mode tuple is bound to multiple 'facts' at runtime and represents a join on several entities.
        /// A JoinRoot mode tuple is a template for a family of Join mode tuple types, and pre-defines
        /// fact storage for a sequence of joins.
        /// </remarks>
        public TupleRole Role { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether, in an ordered tuple, slot names are ignored, and each slot must have 
        /// a designated position.
        /// </summary>
        public bool IsOrdered { get; set; }

        /// <summary>
        /// Gets or sets the name of tuple that this tuple extends.
        /// </summary>
        public string Extends { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the tuple needs to support 'all' indexing.
        /// </summary>
        /// <remarks>
        /// An 'all' index is a dummy index in which all typles of this type
        /// are referenced, regrdless of atribute values.
        /// </remarks>
        public bool IndexAll { get; set; }

        /// <summary>
        /// Gets the collection of tuple attributes for this tuple type.
        /// </summary>
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public IList<Attribute> Attributes { get; private set; }
    }
}
